package com.bocai.kelala.ui.travel.set.ada;

import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.bocai.kelala.R;
import com.bocai.kelala.bean.MyInvoiceBean;
import com.bocai.mybase.base.BaseRecyclerAdapter;
import com.bocai.mybase.base.BaseRecyclerViewHolder;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by yuanfei on 2017/6/9.
 */

public class MyInvoiceAda extends BaseRecyclerAdapter<MyInvoiceBean.OrderListBean> {


    @Override
    public void showData(BaseRecyclerViewHolder viewHolder, int i, List<MyInvoiceBean.OrderListBean> mItemDataList) {
        MyViewHolder myViewHolder = (MyViewHolder) viewHolder;
        myViewHolder.tvEndAddress.setText(mItemDataList.get(i).getArriveCity());
        myViewHolder.tvStartAddress.setText(mItemDataList.get(i).getOriginCity());
        myViewHolder.tvData.setText(mItemDataList.get(i).getBeginTime());
        if (mItemDataList.get(i).getBillingStatus() == 0){
            myViewHolder.tvType.setText("未开票");
            myViewHolder.tvType.setTextColor(Color.parseColor("#666666"));
        }else if (mItemDataList.get(i).getBillingStatus() == 1){
            myViewHolder.tvType.setText("开票中");
            myViewHolder.tvType.setTextColor(Color.parseColor("#7AB872"));
        }else if (mItemDataList.get(i).getBillingStatus() == 2){
            myViewHolder.tvType.setText("已开票");
            myViewHolder.tvType.setTextColor(Color.parseColor("#65B6F8"));
        }

    }

    @Override
    public int getListLayoutId() {
        return R.layout.my_invoice_item;
    }

    @Override
    public RecyclerView.ViewHolder createViewHolder(View view) {
        return new MyViewHolder(view);
    }

    class MyViewHolder extends BaseRecyclerViewHolder {
        @BindView(R.id.tv_type)
        TextView tvType;
        @BindView(R.id.tv_data)
        TextView tvData;
        @BindView(R.id.tv_start_address)
        TextView tvStartAddress;
        @BindView(R.id.tv_end_address)
        TextView tvEndAddress;

        public MyViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
